﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
    public partial class Dom
    {
        //构造函数
        public Dom() { }
        public Dom(HtmlDocument dom) 
        {
            this.document = dom;
        }
        //
        //Select 
        //
        public Object Select(String Func,String action)
        {
            
        }
        public Object Select(String Func, String attribute, String value)
        {
            String Script = "function(){}";
        }
        //
        //Script
        //
        public Object Script(String Script, Object[] Obj)
        {
            return this.Script(this.document,Script, Obj);
        }
        public Object Script(HtmlDocument Dom, String Script, Object[] Obj)
        {
            return Dom.InvokeScript(Script, Obj);
        }
        //
        //Children
        //
        public HtmlElement Children(HtmlElement Elem,Int32 Id)
        {
            return this.Children(Elem.Children, Id);
        }
        public HtmlElement Children(HtmlElementCollection Elem, Int32 Id)
        {
            return Elem[Id];
        }
        //
        //GetElementById
        //
        public HtmlElement GetElementById(String Id)
        {
            return this.GetElementById(this.document, Id);
        }
        public HtmlElement GetElementById(HtmlElement Elem, String Id)
        {
            HtmlDocument Dom = Elem.Document;
            return this.GetElementById(Dom, Id);
        }
        public HtmlElement GetElementById(HtmlWindow Elem, String Id)
        {
            HtmlDocument Dom = Elem.Document;
            return this.GetElementById(Dom, Id);
        }
        public HtmlElement GetElementById(HtmlDocument Dom, String Id)
        {
            return Dom.GetElementById(Id);
        }
        public HtmlElement GetElementById(HtmlElementCollection Elem, String Id)
        {
            return Elem[Id];
        }
        public HtmlElement GetElementById(HtmlElementCollection Elem, Int32 Id)
        {
            return Elem[Id];
        }
        //
        //SetAttribute
        //
        public void SetAttribute(HtmlElement Elem, String Name, String value)
        {
            Elem.SetAttribute(Name, value);
        }
        //
        //Forms
        //
        public HtmlElementCollection Forms()
        {
            return this.Forms(this.document);
        }
        public HtmlElementCollection Forms(HtmlElement Elem)
        {
            return this.Forms(Elem.Document);
        }
        public HtmlElementCollection Forms(HtmlDocument Dom)
        {
            return Dom.Forms;
        }
        //
        //Body 
        //
        public HtmlElement Body()
        {
            return this.Body(this.document);
        }
        public HtmlElement Body(HtmlElement Elem)
        {
            return this.Body(Elem.Document);
        }
        public HtmlElement Body(HtmlDocument Dom)
        {
            return Dom.Body;
        }
        //
        //InnerHtml 
        //
        public string InnerHtml(HtmlElement Elem)
        {
            return Elem.InnerHtml;
        }
        public string InnerHtml(HtmlElement Elem,String String)
        {
            Elem.InnerHtml = String;
            return Elem.InnerHtml;
        }
        //
        // Focus
        //
        public void Focus(HtmlElement Elem)
        {
            Elem.Focus();
        }
        public void Focus(Object Elem)
        {
            Elem.Focus();
        }
        //
        // Click
        //
        public void Click(HtmlElement Elem)
        {
            Elem.InvokeMember("click");
        }
        public void Click(Object Elem)
        {
            Elem.InvokeMember("click");
        }
        //
        // Submit
        //
        public void Submit(HtmlElement Elem)
        {
            Elem.InvokeMember("submit");
        }
        public void Submit(Object Elem)
        {
            Elem.InvokeMember("submit");
        }
        //
        // Reset
        //
        public void Reset(HtmlElement Elem)
        {
            Elem.InvokeMember("reset");
        }
        public void Reset(Object Elem)
        {
            Elem.InvokeMember("reset");
        }
        //
        // Checked
        //
        public void Checked(HtmlElement Elem)
        {
            Elem.InvokeMember("checked");
        }
        public void Checked(Object Elem)
        {
            Elem.InvokeMember("checked");
        }
        //
        //私有成员
        //
        private HtmlDocument document;
    }
}
